package com.lumlord.common.base;

import java.text.SimpleDateFormat;
import java.util.Date;

 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import com.lumlord.common.annotation.ControllerRequestMapping;
import com.lumlord.common.log.Log;
import com.lumlord.common.log.LogFactory;
import com.lumlord.service.SysPremissionService;
import com.lumlord.service.SysRoleService;
import com.lumlord.service.SysUserService;

/**
  * 公共入口类， 提供 路由 入口。
 * @author GPF
 *
 */
@ControllerRequestMapping(path = "/api/{"+ApiController.lumlordVisit+"}/v1/")
public class ApiController {
	
	public static final String lumlordVisit="lumlordVisit";
	
	public Log log = new LogFactory(getClass()); 
	// 系统用户
	@Autowired
	public SysUserService sysUserService;

	// 系统角色
	@Autowired
	public SysRoleService sysRoleService;

	// 权限
	@Autowired
	public SysPremissionService sysPremissionService;
 
	/**
	 * 将前台传递过来的日期格式的字符串，自动转化为Date类型
	 */
	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		dateFormat.setLenient(false);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
	}
	 
}
